//
//  ZNTCollectionViewCell.m
//  B
//
//  Created by Znt on 15/11/5.
//  Copyright © 2015年 wangzhan. All rights reserved.
//

#import "ZNTCollectionViewCell.h"


@implementation ZNTCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubviews];
    }
    return self;
}

- (void)creatSubviews {

    
    self.mainImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 60*XHIGHT)];
    self.mainImage.layer.masksToBounds = YES;
    self.mainImage.layer.cornerRadius = 10;
    [self.contentView addSubview:self.mainImage];
    
    self.mainLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.contentView.frame.size.height - 60 *XHIGHT, self.contentView.frame.size.width, 35)];
    [self.contentView addSubview:self.mainLabel];
    self.mainLabel.textColor = [UIColor blackColor];
    self.mainLabel.font = [UIFont systemFontOfSize:13];
  //  [self .mainLabel sizeToFit];
    self.mainLabel.numberOfLines = 0;
    
    
    self.autorImage = [[UIImageView alloc]initWithFrame:CGRectMake(3 , self.contentView.frame.size.height - 23 * XHIGHT,20 *XWIDTH,20 *XHIGHT)];
    [self.contentView addSubview:self.autorImage];
    self.autorImage.layer.masksToBounds = YES;
    self.autorImage.layer.cornerRadius = 10;
    
    self.autorNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(25*XWIDTH , self.contentView.frame.size.height - 20 * XHIGHT,100 *XWIDTH,15 *XHIGHT)];
    self.autorNameLabel.font = [UIFont systemFontOfSize:12*XHIGHT];
    self.autorNameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:12*XHIGHT];
    
    [self.contentView addSubview:self.autorNameLabel];
    self.autorNameLabel.textColor = [UIColor blackColor];
    
    
    
    
    

}


- (void)setModel2:(Model2 *)model2 {

    _model2 = model2;
    
    [self.mainImage sd_setImageWithURL:[NSURL URLWithString:_model2.index_cover] placeholderImage:[UIImage imageNamed:@""]];
    self.mainLabel.text = _model2.index_title;
    [self.autorImage sd_setImageWithURL:[NSURL URLWithString:_model2.avatar_m] placeholderImage:[UIImage imageNamed:@""]];
     self.autorNameLabel.text = [NSString stringWithFormat:@"by%@",_model2.autorName];
    


}

@end
